from django.db import models


# Create your models here.


class User(models.Model):
    gender = (
        ('male', '男'),
        ('female', '女'),
    )
    name = models.CharField(max_length=128, unique=True)
    password = models.CharField(max_length=256)
    phone_number = models.CharField(max_length=11, unique=True)
    # email = models.EmailField(unique=True)
    sex = models.CharField(max_length=32, choices=gender, default='男')
    c_time = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.name

    class Meta:
        ordering = ['c_time']
        verbose_name = '用户'
        verbose_name_plural = '用户'


class PhoneCheck(models.Model):
    pid = models.IntegerField(default=1)
    phone_number = models.CharField(max_length=11, unique=True)
    check_number = models.CharField(max_length=6)
    c_time = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.phone_number

    class Meta:
        ordering = ['c_time']
